<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>dokumen admin</title>
        <link href="../../script/seminar.css" rel="stylesheet"/>
        <script type="text/javascript">
            function fnLogOut() {
                document.dokumenAdminForm.method = 'POST';
                document.dokumenAdminForm.action = '../../logic/logout.php';
                document.dokumenAdminForm.submit();
            }
            function fnSendSms(vNum,vKode,vNoHp) {
                var vJudul = document.getElementById('hidJudulPaper_'+vNum).value;
                var vWinH = document.body.offsetHeight;
                var vWinW = document.body.offsetWidth;
                var vPopupH = 300;
                var vPopupW = 630;
                var vPosTop = (vWinH-vPopupH)/2;
                var vPosLeft = (vWinW-vPopupW)/2;
                var vURL = "smsForm.php?init=1&kodeSms=" +vKode + "&noHp=" + String(vNoHp) + "&judul=" + vJudul;
                var vName = "SMS Form";
                var vSpecs = "width="+vPopupW+", height="+vPopupH+", top="+vPosTop+", left="+vPosLeft+", titlebar=no, menubar=no, status=no, resizable=no";
                window.open(vURL, vName, vSpecs);
            }
            
            function fnRefresh() {
                location.reload();
            }
        </script>
    </head>
    <body>
        <?php
        include("../../utility/connection.php");
        include("../../utility/general.php");
        include("../../model/mPaper.php");
        
        session_start();
        if (isset($_SESSION['arrResult'])) {
            $arrResult = $_SESSION['arrResult'];
        ?>
        <form name="dokumenAdminForm" id="dokumenAdminForm">
        <table border="0" width="100%" height="100%">
            <tr valign="middle">
                <td align="center">
                    
                    <table width="90%" border="0" cellpadding="2" cellspacing="0">
                        <tr class="tbl-body">
                            <td>
                                <table width="100%" height="100%" border="1" cellpadding="5" cellspacing="0">
                                    <tr class="tbl-header">
                                        <td rowspan="2">No</td>
                                        <td rowspan="2">Nama</td>
                                        <td width="20%">Tema</td>
                                        <td width="50%">Nama&nbsp;File</td>
                                        <td rowspan="2">Tgl&nbsp;Upload</td>
                                        <td rowspan="2">&nbsp;</td>
                                    </tr>
                                    <tr class="tbl-header">
                                        <td>Judul</td>
                                        <td>Ringkasan</td>
                                    </tr>
                                    <?php
                                    $resultFileInfo = fnGetListFile();
                                    if ($resultFileInfo) {
                                        $num = 1;
                                        while($rowFileInfo = mysql_fetch_row($resultFileInfo)){
                                            $tglOrig = $rowFileInfo[9];
                                            $digitTgl = substr($tglOrig,-2,2);
                                            $digitBulan = fnConvertMonth(substr($tglOrig,-5,2));
                                            $digitTahun = substr($tglOrig,0,4);
                                            $NoTelp = strval($rowFileInfo[10]);
                                            
                                            $PaperId = $rowFileInfo[4];
                                            $resultPaperReviewer = fnPaperReviewer($PaperId);
                                            $noHpReviewer = '';
                                            if ($resultPaperReviewer) {
                                                $paperReviewer = mysql_fetch_row($resultPaperReviewer);
                                                $noHpReviewer = $paperReviewer[2];
                                            }
                                            
                                            $JudulPaper = $rowFileInfo[5];
                                    ?>
                                    <tr>
                                        <td rowspan="2"><?php echo $num ?></td>
                                        <td rowspan="2"><?php echo $rowFileInfo[2] ?></td>
                                        <td><?php echo $rowFileInfo[3] ?></td>
                                        <td><?php echo $rowFileInfo[7] ?></td>
                                        <td rowspan="2"><?php echo $digitTgl ?>&nbsp;<?php echo $digitBulan ?>&nbsp;<?php echo $digitTahun ?></</td>
                                        <td rowspan="2">
                                            <input style="display: none" type="text" name="hidUserID_<?php echo $num ?>" id="hidUserID_<?php echo $num ?>" value="<?php echo $rowFileInfo[1] ?>">
                                            <input style="display: none" type="text" name="hidPaperID_<?php echo $num ?>" id="hidPaperID_<?php echo $num ?>" value="<?php echo $rowFileInfo[4] ?>">
                                            <input style="display: none" type="text" name="hidJudulPaper_<?php echo $num ?>" id="hidJudulPaper_<?php echo $num ?>" value="<?php echo $JudulPaper ?>">
                                            <button type="button" style="width: 100px;" name="btSmsSpeaker" id="btSmsSpeaker" onclick="fnSendSms(<?php echo $num ?>,1,'<?php echo $NoTelp ?>')">Receipt</button>
                                            <button type="button" style="width: 100px;" name="btSmsReviewer" id="btSmsReviewer" onclick="fnSendSms(<?php echo $num ?>,2,'<?php echo $noHpReviewer ?>')">Notification</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><?php echo $JudulPaper ?></td>
                                        <td><?php echo $rowFileInfo[6] ?></td>
                                    </tr>
                                    <?php
                                        $num = $num + 1;
                                        }
                                    }
                                    ?>
                                </table>
                            </td>
                        </tr>
                    </table>
                    
                </td>
            </tr>
            <tr valign="middle">
                <td align="center">
                    <button type="button" name="btLogOut" id="btLogOut" onclick="fnLogOut()">LogOut</button>
                </td>
            </tr>
        </table>
        </form>
        <?php
        }
        ?>
    </body>
</html>
